<?if(!defined("B_PROLOG_INCLUDED")||B_PROLOG_INCLUDED!==true)die();?>
<?
if ($_GET["DEBUG"] == "Y")
{
	echo "<pre>";
	print_r ($arParams);
	print_r ($arResult);
	echo "<pre>";
}

if (count($arResult["ERRORS"]) > 0):
	foreach ($arResult["ERRORS"] as $error)
		echo '<br><span class="alert">'.$error.'</span><br>';
else:
?>
	<script type="text/javascript">
		var sonetChatMsgAddPath = '<?= $arResult["MsgAddPath"] ?>';
		var sonetChatMsgGetPath = '<?= $arResult["MsgGetPath"] ?>';
		var sonetChatSessid = '<?= bitrix_sessid_get() ?>';
		var sonetChatNowDate = '<?= $arResult["Now"]; ?>';
		var sonetChatTimeout = <?= 10.00 ?>;
		var startShowMessageID = <?= 0 ?>;
		var stream_id = <?=$arParams["stream_id"] ?>;
		var curUserID = <?=$arResult["CUR_USER"]["ID"] ?>;
		//LANG//
		var messageTrSystem = "System message";
		var messageTrSystem = "Network error. Message send failed";

	</script>

	<form name="sonet_chat_form" action="" onsubmit="sonet_chat_msg_add(); return false;" onmouseover="if(null != init_form){init_form(this)}" onkeydown="if(null != init_form){init_form(this)}">


	<div id="socnet_chat_body" class="socnet-chat-body" style="height: 417px;">
		
		<form name="sonet_chat_form" action="" onsubmit="sonet_chat_msg_add(); return false;" onmouseover="if(null != init_form){init_form(this)}" onkeydown="if(null != init_form){init_form(this)}">

		<div class="socnet-chat-info" id="socnet_chat_info">

			<table cellspacing="0" cellpadding="0">
				<tr valign="top">

					<td class="bx-photo"><div id="bx-photo"></div></td>
					<td>
						<div id="socnet-user-name" class="socnet-user-name"></div>
						<div id="socnet_user_online" class="bx-icon <?= ($arResult["IS_ONLINE"]? "bx-icon-online":"bx-icon-offline")?>" title="<?= ($arResult["IS_ONLINE"]? GetMessage("SONET_C50_T_ONLINE"):GetMessage("SONET_CHAT_OFFLINE")) ?>"></div>
						<div id="socnet_user_online_text"><?= ($arResult["IS_ONLINE"]? "Online":"Offline") ?></div>
						
					</td>

					<td class="bx-border">
						<a class="socnet-button socnet-button-profile" href="<?= $arResult["Urls"]["User"] ?>" target="_blank" title="<?= GetMessage("SONET_C50_T_TO_PROFILE_ALT") ?>"></a>
						<a href="javascript:void(0);" class="socnet-button <?=($arResult["USER_OPTIONS"]["sound"] == "Y"? "socnet-sound-on":"socnet-sound-off")?>" title="<?=($arResult["USER_OPTIONS"]["sound"] == "Y"? GetMessage("PM_SOUND_ON"):GetMessage("PM_SOUND_OFF"))?>" onclick="sonet_switch_sound(this)"></a>
					</td>
					<td class="bx-border">
					<div id="users_online" class="users_online">

					<div>
					</td>

				</tr>
			</table>
			
	</div>
		<div id="sonet_chat_messages" style="height: 176px;"></div>
		<div id="socnet_chat_form" class="socnet-chat-form">
			<div class="socnet-chat-buttons">

				<div class="form-button button-bold" id="form_b" title="PM_BOLD"></div>
				<div class="form-button button-italic" id="form_i" title="PM_ITAL"></div>
				<div class="form-button button-underline" id="form_u" title="PM_UNDER"></div>
				<div class="form-button button-font">
					<select name='FONT' id='form-font' title="PM_FONT">
						<option value='0'>PM_FONT</option>
						<option value='Arial' style='font-family:Arial'>Arial</option>
						<option value='Times' style='font-family:Times'>Times</option>
						<option value='Courier' style='font-family:Courier'>Courier</option>
						<option value='Impact' style='font-family:Impact'>Impact</option>
						<option value='Geneva' style='font-family:Geneva'>Geneva</option>
						<option value='Optima' style='font-family:Optima'>Optima</option>
						<option value='Verdana' style='font-family:Verdana'>Verdana</option>
					</select>
				</div>
				<div class="form-button button-color" id="form_palette" title="PM_COLOR"></div>
				<div class="form-button button-url" id="form_url" title="PM_HYPERLINK_TITLE"></div>
				<div class="form-button button-img" id="form_img" title="PM_IMAGE_TITLE"></div>
				<div class="form-button button-quote" id="form_quote" title="PM_QUOTE_TITLE"></div>
				<br style="clear:both;" />
			</div>


			<div class="socnet-chat-input">
				<?=bitrix_sessid_post()?>
				<textarea id="post_message_id" name="POST_MESSAGE" rows="5"></textarea><br>
				<input id="post_message_button" type="submit" name="save" value="SEND_MESSAGE">
				Ctrl+Enter<br>
			</div>
		</div>

		</form>
	</div>
<?
endif;
?>